package com.vip.shopservice.admin.service.impl;

import com.vip.shopbase.Service.impl.GenericManagerImpl;
import com.vip.shopdao.admin.dao.UserDao;
import com.vip.shopdao.admin.domain.User;
import com.vip.shopservice.admin.service.UserManager;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.transaction.Transactional;

/**
 * @author l1532
 */
@Component
@Transactional
public class UserManagerImpl extends GenericManagerImpl<User,Long> implements UserManager, InitializingBean {
    UserDao userDao;

    @Autowired
    public void setUserDao(UserDao userDao){
        this.userDao = userDao;
        this.dao = this.userDao;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
//        String isnull = Objects.isNull(userDao)?"UserDao是空":"UserDao非空";
//        System.out.println("UserManager被注入，"+isnull);

    }

    @Override
    public User findByUsername(String username) {
        return userDao.findByName(username);
    }
}
